<template>
  <div class="page-department">
    <div class="component-mainHeader">
      <div class="top">
        <div class="topleft">
          <p>
            <span class="iconfont" style="color:#1abc9a;margin-right:3px;">&#xe607;</span>统计总表
          </p>
        </div>
        <div class="topright">
          <el-button type="info" @click="$router.go(-1)">
            <span style="font-weight:700;margin-right:5px;" class="iconfont">&#xe606;</span>后退
          </el-button>
        </div>
      </div>
    </div>

    <div class="component-listHeader">
      <div class="search-header">
        <div class="left-title">
          <p class="left-text">
            <span class="iconfont">&#xe61e;</span>
            {{title}}
          </p>
          <div class="right">
            <button style="width:120px;" @click="outputExcel">导出Excel</button>
          </div>
        </div>
      </div>
    </div>

    <div class="table">
      <el-table ref="multipleTable" :data="info" tooltip-effect="dark" style="width:100%" border>
        <el-table-column label="需求日期" align="center" width="110" prop="col_1"></el-table-column>
        <el-table-column label="扩容类型" align="center" width="100" prop="col_2"></el-table-column>
        <el-table-column label="所属单位(甲供料业主铁通)" align="center" width="200" prop="col_3"></el-table-column>
        <el-table-column label="所属工队" align="center" width="130" prop="col_4"></el-table-column>
        <el-table-column label="是否超时" align="center" width="100" prop="col_5"></el-table-column>
        <el-table-column label="修补扩类型" align="center" width="130" prop="col_6"></el-table-column>
        <el-table-column label="关联安装工单号" align="center" width="170" prop="col_7"></el-table-column>
        <el-table-column label="片区" align="center" width="100" prop="col_8"></el-table-column>
        <el-table-column label="镇区" align="center" width="100" prop="col_9"></el-table-column>
        <el-table-column label="五级站点" align="center" width="180" prop="col_10"></el-table-column>
        <el-table-column label="需求内容" align="center" width="300" prop="col_11"></el-table-column>
        <el-table-column label="箱体名称" align="center" width="250" prop="col_12"></el-table-column>
        <el-table-column label="分光器名称" align="center" width="170" prop="col_13"></el-table-column>
        <el-table-column label="箱体个数" align="center" width="100" prop="col_14"></el-table-column>
        <el-table-column label="分光器数" align="center" width="100" prop="col_15"></el-table-column>
        <el-table-column label="总端口数" align="center" width="100" prop="col_16"></el-table-column>
        <el-table-column label="结算费用(元)" align="center" width="120" prop="col_17"></el-table-column>
        <el-table-column label="完工日期" align="center" width="110" prop="col_18"></el-table-column>
        <el-table-column label="现场当前环节" align="center" width="115" prop="col_19"></el-table-column>
        <el-table-column label="装维人员联系电话" align="center" width="135" prop="col_20"></el-table-column>
        <el-table-column label="装维人员姓名" align="center" width="110" prop="col_21"></el-table-column>
        <el-table-column label="系统当前环节" align="center" width="110" prop="col_22"></el-table-column>
        <el-table-column label="箱体材料" align="center" width="100" prop="col_23"></el-table-column>
        <el-table-column label="光缆芯数" align="center" width="100" prop="col_24"></el-table-column>
        <el-table-column label="光缆米数" align="center" width="100" prop="col_25"></el-table-column>
        <el-table-column label="分光器类型" align="center" width="100" prop="col_26"></el-table-column>
        <el-table-column label="分光器个数" align="center" width="110" prop="col_27"></el-table-column>
        <el-table-column label="服开工单号" align="center" width="110" prop="col_28"></el-table-column>
        <el-table-column label="服开起单时间" align="center" width="110" prop="col_29"></el-table-column>
        <el-table-column label="派单时间" align="center" width="110" prop="col_30"></el-table-column>
        <el-table-column label="服开环节" align="center" width="110" prop="col_31"></el-table-column>
        <el-table-column label="备注" align="center" width="110" prop="col_32"></el-table-column>
      </el-table>
    </div>

    <!-- 分页 -->
    <div class="component-paging" v-if="info.length > 0">
      <div class="table-bottom">
        <div class="bottom-left" style="margin-left: 42px;"></div>
        <div class="paging">
          <div class="paging-left">
            <p>
              共
              <span>{{Math.ceil(total/pageSize)}}</span> 页/
              <span>{{total}}</span> 条数据
            </p>
          </div>
          <el-pagination
            background
            @size-change="SizeChange($event,dataInit,currentPage,pageSize)"
            @current-change="CurrentChange($event,dataInit,currentPage,pageSize)"
            :current-page="currentPage"
            :page-sizes="[10, 20, 30, 50]"
            :page-size="pageSize"
            layout="sizes, prev, pager, next, jumper"
            :total="total"
          ></el-pagination>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "operation",
  data() {
    return {
      title: "补盲扩统计列表",
      info: [],
      // 数据总条数
      total: 0,
      // 每页显示数据的条数
      pageSize: 10,
      // 当前显示的页面页码
      currentPage: 1,
      // 基础图片路径
      baseUrl:img_url
    };
  },
  created() {
    this.dataInit();
  },
  mounted() {},
  methods: {
    // 根据query 里的proId 进行请求 渲染表格
    dataInit() {
      let that = this,
        suCb = function(res) {
          console.log("查询结果", res);
          that.info = res.data.data.data;
          that.total = res.data.data.rowCount;
        },
        erCb = function(res) {
          console.log(res);
        },
        palyParam = {
          url: "/api/web/proProject/getBMKAccoutTable",
          methods: "post",
          data: {
            proIds:that.$route.query.proIds,
            // proIds:["e289c1d9-679f-418c-beba-a5b30bdc"]
            pageSize:that.pageSize,
            pageCurrent:that.currentPage
          },
          success: suCb,
          error: erCb
        };
      that.$https(palyParam);
    },
    // 导出excel
    outputExcel(){
      let that = this,
          suCb = res => {
            console.log("结果：", res);
            let a = document.createElement("a");
            a.href = that.baseUrl + res.data.data.url;
            a.download = res.data.data.fileName;
            // a.target = '_blank'
            console.log(a.href)
            a.click();
            that.$msg("生成成功");
          },
          erCb = res => {
            console.log(res);
          },
          req = {
            url: "/api/web/sysFile/toProcessBMKAccountExecl",
            methods: "post",
            data: { 
              // proIds:["e289c1d9-679f-418c-beba-a5b30bdc"],
              proIds: that.$route.query.proIds
            },
            success: suCb,
            error: erCb
          };
        that.$https(req);
    }
  }
};
</script>

<style scoped>
.component-searchHeader .search-header {
  width: 1100px;
  box-sizing: border-box;
  border: 1px solid rgba(228, 228, 228, 1);
  background-color: rgba(255, 255, 255, 1);
  margin: 20px auto 0;
}

.component-searchHeader .search-header .left-title {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background-color: rgba(243, 243, 243, 1);
  height: 45px;
  box-sizing: border-box;
}

.component-searchHeader .search-header .left-title .left-text {
  width: 20%;
  color: #666;
  line-height: 45px;
  font-family: "微软雅黑";
  font-weight: 400;
  font-size: 12px;
  text-align: left;
  margin: 0 0 0 30px;
}

.component-searchHeader .right {
  width: 70%;
  display: flex;
  justify-content: flex-end;
  margin-right: 30px;
}

.component-searchHeader .right button {
  padding: 0 15px;
  height: 30px;
  margin: 6px 5px;
  line-height: 30px;
  font-size: 12px;
  color: #666;
  background-color: #fff;
  border: 1px solid #ccc;
}

.component-searchHeader .right button:hover {
  background-color: #f3f3f3;
}

.component-search-box {
  width: 1100px;
  height: 60px;
  box-sizing: border-box;
  background-color: #fff;
  border: 1px solid #e4e4e4;
  border-top: none;
  margin: 0 auto;
  text-align: left;
  padding-left: 30px;
  line-height: 60px;
}

.component-search-box .el-input__inner {
  height: 36px;
  display: inline-block;
  vertical-align: middle;
}

.component-listHeader .search-header {
  width: 1100px;
  box-sizing: border-box;
  border: 1px solid rgba(228, 228, 228, 1);
  background-color: rgba(255, 255, 255, 1);
  margin: 20px auto 0;
  border-bottom: 0;
}

.component-listHeader .search-header .left-title {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background-color: rgba(243, 243, 243, 1);
  height: 45px;
  box-sizing: border-box;
}

.component-listHeader .search-header .left-title .left-text {
  width: 20%;
  color: #666;
  line-height: 45px;
  font-family: "微软雅黑";
  font-weight: 400;
  font-size: 12px;
  text-align: left;
  margin: 0 0 0 30px;
}

.component-listHeader .search-header .right {
  width: 70%;
  display: flex;
  justify-content: flex-end;
  margin-right: 10px;
}

.component-listHeader .search-header .right button {
  padding: 0 15px;
  height: 30px;
  width: 80px;
  margin: 6px 5px;
  line-height: 30px;
  font-size: 14px;
  color: #666;
  background-color: #fff;
  border: 1px solid #ccc;
}

.component-listHeader .search-header .right button:hover {
  background-color: #f3f3f3;
}

.component-listHeader .search-header .right .right-select-margin {
  margin-top: 6px;
  margin-right: 8px;
}

.component-table-header {
  width: 1100px;
  margin: 0 auto;
  display: flex;
  border: 1px solid #e4e4e4;
  background-color: #f9fafc;
  height: 45px;
  line-height: 45px;
  padding: 0;
  list-style: none;
  justify-content: space-between;
  box-sizing: border-box;
  border-top: none;
}

.component-table-header li:first-child {
  width: 50px;
}

.component-table-header li:first-child span {
  border-radius: 5px;
  border: 2px solid #aba2a2;
  display: inline-block;
  width: 16px;
  height: 16px;
  margin: 12.5px auto;
  line-height: 16px;
  font-size: 16px;
}

.component-table-header li {
  border-right: 1px solid #e4e4e4;
  font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC";
  font-weight: 650;
  font-style: normal;
  font-size: 14px;
  color: #666666;
}
.component-table-header li:last-child {
  border: none;
}

.component-table-body {
  width: 1100px;
  margin: 0 auto;
  display: flex;
  border: 1px solid #e4e4e4;
  background-color: #fff;
  height: 45px;
  line-height: 45px;
  padding: 0;
  list-style: none;
  justify-content: space-between;
  box-sizing: border-box;
  border-top: none;
}

.component-table-body li {
  font-size: 12px;
  color: #666;
  text-align: center;
  border-right: 1px solid #e4e4e4;
}

.component-table-body li:first-child {
  width: 50px;
}

.component-table-body li:nth-child(2) {
  width: 100px;
}

.component-table-body li:nth-child(3) {
  width: 150px;
}

.component-table-body li:nth-child(4) {
  width: 150px;
}
.component-table-body li:nth-child(5) {
  width: 150px;
}

.component-table-body li:last-child {
  width: 500px;
  border-right: none;
}

.component-table-body li:last-child {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  padding: 0 auto;
}

.component-table-body li:last-child a {
  display: inline-block;
  text-align: center;
  color: #1abc9c;
  text-decoration: none;
  font-size: 12px;
}

/* 下面都是修改饿了么ui的下拉框和按钮选中后的样式 */

.el-select .el-input.is-focus .el-input__inner,
.el-select .el-input__inner:focus {
  border-color: #e4e4e4;
}

.el-select-dropdown__item.selected {
  color: #666;
  font-weight: 400;
}

.el-select-dropdown {
  min-width: 100px !important;
  top: 50px !important;
  margin-left: 5px;
}
.el-select-dropdown__item {
  height: 26px;
  line-height: 26px;
}

.el-select .el-input__inner {
  width: 100px;
  padding: 0 8px;
  margin: 6px 5px;
}
.component-paging .table-bottom .all-left button {
  background-color: #fff;
}
.component-paging .table-bottom .all-left button:hover {
  background-color: #f3f3f3;
}

.table {
  width: 1100px;
  margin: 0 auto;
}
.options {
  color: #1abc9c;
  padding: 0 5px;
  cursor: pointer;
}
.el-textarea {
  width: 220px;
  vertical-align: top;
}

.component-models .el-form-item {
  width: 512px;
  margin-bottom: 10px;
}
.component-models .el-select {
  left: -50px;
}
</style>
